Ext.define("Portal.view.main.ToolbarWrap",{
    extend:"Ext.toolbar.Toolbar",
    height: 46,
    border:false,
    itemId: 'headerBar',
    alias:'widget.main.toolbarWrap',
    requires:[
        'Portal.controller.main.ToolbarWrapController',
        'Portal.store.toolbar.SearchStore'
    ],
    controller:'main.toolbarWrapController',
    items:[
        {
            xtype: 'component',
            cls: '',
            reference:'webEasyLogo',
            html: '<div class="logo"><img src="./images/logo.png" alt=""><span class="logo-text">WebEasy</span></div>',
            width: 200
        },
        {
            margin: '0 30 0 0',
            ui: 'header',
            iconCls:'fa fa-bars',
            id: 'main-navigation-btn',
            handler: 'onToggleNavigationSize'
        },
        {
            xtype:'toolbar',
            cls: 'nav-list',
            border:false,
            reference:'toolbanrMenu',
            items:[
                {
                    text: '首页',
                    href: '#home',
                    hrefTarget: '_self',
                    border:false,
                    cls:'toolbar-btn',
                    overCls:'toolbar-btn-over'
                },
                {
                    xtype: 'splitbutton',
                    text : '设置',
                    border:false,
                    cls:'toolbar-btn',
                    overCls:'toolbar-btn-over',
                    reference: 'splitbutton',
                    menu:[
                        {
                            text:'石墨',
                            iconCls:'fa fa-github',
                            href: '#pages.shimo',
                            hrefTarget: '_self'
                        },
                        {
                            text:'百度',
                            iconCls:'fa fa-exclamation-triangle',
                            href: '#pages.baidu',
                            hrefTarget: '_self'
                        }
                    ]
                }
            ]
        },
        '->',
        {
            xtype: 'button',
            reference: 'customMenuContainer',
            border:false,
            cls:'toolbar-btn',
            overCls:'toolbar-btn-over',
            iconCls: 'fa fa-plus-square',
            menu:{
                extend:'menu',
                width:200,
                plain:true,
                cls:'webEasy-menu-box',
                items:[
                    {
                        text:'石墨文档',
                        href:'#pages.shimo',
                        routeId:'pages.shimo',
                        hrefTarget: '_self'
                    },
                    {xtype: 'menuseparator'},
                    {
                        text:'自定义快捷方式',
                        href:'#setting.customSettings',
                        hrefTarget: '_self',
                    }
                ],
                listeners:{
                    click:'customMenuChange',
                }
            }
        },
        {
            xtype:'pickerfield',
            emptyText:'搜索11',
            margin:'0 10px',
            reference:'toolbanrSearch',
            createPicker:function(){
                return this.createGridPicker()
            },
            createGridPicker:function(){
                var self = this;
                return Ext.create('Ext.grid.Panel',{
                    floating:true,
                    itemId:'gridBox',
                    columns: [
                        { text: '结果', dataIndex: 'name',flex: 1  }
                    ],
                    store:{
                        type:'toolbar.search'
                    },
                    minWidth:100,
                    listeners:{
                        scope:self
                    }
                });
            },
            listeners:{
                focus:'searchOnClick',
                change:'searchInput'
            }
        },
        {
            xtype:'button',
            height: 35,
            cls:'toolbar-btn',
            overCls:'toolbar-btn-over',
            border:false,
            html:'<div class="webEay-user-icon"><img src="./images/user.jpg"></div>',
            menu:{
                extend:'menu',
                width:200,
                plain:true,
                cls: 'webEasy-menu-box',
                items:[
                    {
                        text: '尹高峰',
                        canActivate:false
                    },
                    {xtype: 'menuseparator'},
                    {
                        text:'个人资料',
                        href: '#userInformation',
                        hrefTarget: '_self',
                        viewId:'user.userInformation',
                        viewType:'view'
                    },
                    {
                        text:'设置',
                        href: '#userSetting',
                        hrefTarget: '_self',
                        viewId:'user.UserSetting',
                        viewType:'view'
                    },
                    {
                        text:'帮助',
                        href: '#userHelp',
                        hrefTarget: '_self',
                        viewUrl:'http://www.baidu.com',
                        viewType:'url'
                    },
                    {xtype: 'menuseparator'},
                    {
                        text:'退出',
                        listeners:{
                            click:'userSignOut'
                        }
                    }
                ],
                listeners:{
                    click:'userListClick'
                }
            }
        }
    ]
});